package com.youkeda.app.dataobject;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.youkeda.app.model.User;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * user
 * @author 
 */
@Data
public class UserDO implements Serializable {
    private Long id;

    private String mobile;

    private Integer valid;

    private String nickname;

    private String avatar;

    private String password;

    private String gender;

    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime gmtCreated;

    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime gmtModified;

    private static final long serialVersionUID = 1L;

    public UserDO() {
    }

    public UserDO(User user){
            BeanUtils.copyProperties(user,this);
        }

        public User convertToModel(){
            User user = new User();
            BeanUtils.copyProperties(this,user);
            return user;
        }
}